package com.fitns.user.mapper.baseConfig;

import static com.fitns.user.mapper.baseConfig.TbCheckVehicleModifyDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbCheckVehicleModify;
import java.util.List;
import javax.annotation.Generated;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbCheckVehicleModifyMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbCheckVehicleModify> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbCheckVehicleModifyResult")
    TbCheckVehicleModify selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbCheckVehicleModifyResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="score", property="score", jdbcType=JdbcType.REAL),
        @Result(column="modify_time", property="modifyTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_id", property="createId", jdbcType=JdbcType.BIGINT),
        @Result(column="modify_id", property="modifyId", jdbcType=JdbcType.BIGINT)
    })
    List<TbCheckVehicleModify> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(tbCheckVehicleModify);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, tbCheckVehicleModify);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, tbCheckVehicleModify)
                .where(id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbCheckVehicleModify record) {
        return insert(SqlBuilder.insert(record)
                .into(tbCheckVehicleModify)
                .map(content).toProperty("content")
                .map(type).toProperty("type")
                .map(score).toProperty("score")
                .map(modifyTime).toProperty("modifyTime")
                .map(createTime).toProperty("createTime")
                .map(createId).toProperty("createId")
                .map(modifyId).toProperty("modifyId")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbCheckVehicleModify record) {
        return insert(SqlBuilder.insert(record)
                .into(tbCheckVehicleModify)
                .map(content).toPropertyWhenPresent("content", record::getContent)
                .map(type).toPropertyWhenPresent("type", record::getType)
                .map(score).toPropertyWhenPresent("score", record::getScore)
                .map(modifyTime).toPropertyWhenPresent("modifyTime", record::getModifyTime)
                .map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
                .map(createId).toPropertyWhenPresent("createId", record::getCreateId)
                .map(modifyId).toPropertyWhenPresent("modifyId", record::getModifyId)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckVehicleModify>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, id, content, type, score, modifyTime, createTime, createId, modifyId)
                .from(tbCheckVehicleModify);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCheckVehicleModify>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, id, content, type, score, modifyTime, createTime, createId, modifyId)
                .from(tbCheckVehicleModify);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbCheckVehicleModify selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, id, content, type, score, modifyTime, createTime, createId, modifyId)
                .from(tbCheckVehicleModify)
                .where(id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbCheckVehicleModify record) {
        return UpdateDSL.updateWithMapper(this::update, tbCheckVehicleModify)
                .set(content).equalTo(record::getContent)
                .set(type).equalTo(record::getType)
                .set(score).equalTo(record::getScore)
                .set(modifyTime).equalTo(record::getModifyTime)
                .set(createTime).equalTo(record::getCreateTime)
                .set(createId).equalTo(record::getCreateId)
                .set(modifyId).equalTo(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbCheckVehicleModify record) {
        return UpdateDSL.updateWithMapper(this::update, tbCheckVehicleModify)
                .set(content).equalToWhenPresent(record::getContent)
                .set(type).equalToWhenPresent(record::getType)
                .set(score).equalToWhenPresent(record::getScore)
                .set(modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(createTime).equalToWhenPresent(record::getCreateTime)
                .set(createId).equalToWhenPresent(record::getCreateId)
                .set(modifyId).equalToWhenPresent(record::getModifyId);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbCheckVehicleModify record) {
        return UpdateDSL.updateWithMapper(this::update, tbCheckVehicleModify)
                .set(content).equalTo(record::getContent)
                .set(type).equalTo(record::getType)
                .set(score).equalTo(record::getScore)
                .set(modifyTime).equalTo(record::getModifyTime)
                .set(createTime).equalTo(record::getCreateTime)
                .set(createId).equalTo(record::getCreateId)
                .set(modifyId).equalTo(record::getModifyId)
                .where(id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbCheckVehicleModify record) {
        return UpdateDSL.updateWithMapper(this::update, tbCheckVehicleModify)
                .set(content).equalToWhenPresent(record::getContent)
                .set(type).equalToWhenPresent(record::getType)
                .set(score).equalToWhenPresent(record::getScore)
                .set(modifyTime).equalToWhenPresent(record::getModifyTime)
                .set(createTime).equalToWhenPresent(record::getCreateTime)
                .set(createId).equalToWhenPresent(record::getCreateId)
                .set(modifyId).equalToWhenPresent(record::getModifyId)
                .where(id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}